#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
void xuan(int arr[], int left, int right)
{
    while (left < right)
    {
        int tmp = arr[left];
        arr[left] = arr[right];
        arr[right] = tmp;
        left++;
        right--;
    }
}

void rotate(int* nums, int numsSize, int k) {
    k %= numsSize;
    xuan(nums, 0, numsSize - k - 1);
    xuan(nums, numsSize - k, numsSize - 1);
    xuan(nums, 0, numsSize - 1);
}
int main()
{
    int nums[10] = { 1,2,3,4,5,6,7,8,9,0 };
    rotate(nums, 10, 3);
    for (int i = 0; i < 10; i++)
        printf("%d ", nums[i]);
    return 0;
}